class Admin::PhotosController < ApplicationController
  layout "admin"
  
  helper :button
  
  before_filter :login_required
  
  access_control :DEFAULT => 'admin | photos'
  
  resource_this :will_paginate => true, :path_prefix => 'admin_', :nested => [:album]
  
  def create_photo
    params[:photo].each do |photo| 
    if photo.size > 0
      @album.photos << Photo.new(:uploaded_data => photo)
    end
    end unless params[:photo].nil?
  end
  
  def create
    respond_to do |format|
     flash[:notice] = 'Photos successfully uploaded.'
     format.html { redirect_to admin_album_photos_url(@album) }
     format.js
    end
  end
  
end
